package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.bank.Account;

public abstract class AbstractAccount implements Account {

	protected double balance;

	@Override
	public double getBalance() {

		return balance;
	}

	@Override
	public void deposit(double x) {
		if (x > 0) {
			balance += x;
		}
	}

	AbstractAccount(double balance) {
		this.balance = balance;
	}

	public void withdraw(double x) {
		if (x <= balance && x > 0) {
			balance -= x;
		}
	}

	@Override
	public double maximumAmountToWithdraw() {
		return balance;
	}

}
